﻿@{
    ViewBag.Title = "PublishGoods";
    Layout = "~/Views/Shared/_MainLayout.cshtml";
}
<script src="../../Scripts/jquery-1.4.4-vsdoc.js" type="text/javascript"></script>
<link href="@Url.Content("~/Content/main.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        GetParentGoodsCat();
        $('#parentGoodsCat').change(function () { GetChildGoodsCat() });
        $('#GoodsCat').change(function () { SelectGoodsCat() });
    });

    function GetParentGoodsCat() {
        $('#parentGoodsCat').empty();
        $("#GoodsCat").empty();
        $('#lblGoodsCat').empty();

        $.getJSON("/Ajax/GetGoodsCatsByGrade/1", function (data) {
            $.each(data, function (i, item) {
                $("<option></option>")
                    .val(item["Value"])
                    .text(item["Text"])
                    .appendTo($('#parentGoodsCat'));
            });
        });
    }

    function GetChildGoodsCat() {
        $("#GoodsCat").empty();
        $('#lblGoodsCat').empty();
        var url = "/Ajax/GetChildGoodsCats/" + $('#parentGoodsCat').val();
        $.getJSON(url, function (data) {
            $.each(data, function (i, item) {
                $("<option></option>")
                    .val(item["Value"])
                    .text(item["Text"])
                    .appendTo($('#GoodsCat'));
            });
        });
    }

    function SelectGoodsCat() {
        //alert($('#GoodsCat').val());
        document.getElementById('lblGoodsCat').innerHTML = $('#GoodsCat option:selected').text();
    }
</script>
<div class="top_login_nav">
    <div class="top_login_nav_box">
        <ul>
            <li class="top_login_nav_tag">1.&nbsp;选择商品分类</li>
            <li>2.&nbsp;填写商品详细</li>
            <li>3.&nbsp;发布商品成功</li>
        </ul>
    </div>
</div>
<div class="wrap">
    <!--产品发布开始-->
    @using (Html.BeginForm())
    { 
        <div class="entry_box">
            <div class="enter_text" style="text-align: center;">
                <select id="parentGoodsCat" name="parentGoodsCat" style="height: 300px; width: 300px;"
                    multiple="multiple">
                </select>
                <select id="GoodsCat" name="GoodsCat" style="height: 300px; width: 250px;" multiple="multiple">
                </select>
                <div class="tips" style="width: 300px; float: right; display: block; margin-top: 10px;">
                    <img align="absMiddle" src="/Content/images/lightbulb.gif" />&nbsp;<span class="red">您选择的类别是：</span>
                    <label id="lblGoodsCat" name="lblGoodsCat">
                    </label>
                     @Html.ValidationMessage("GoodsCat")
                </div>
               
            </div>
        </div>
        <div class="entry_box_btn">
            <input style="background-image: url('/content/images/btn7.gif'); margin:0px; padding:0px; border:0; width:219px; height:45px;" value=" " type="submit" />
        </div>
    }
</div>
<!--底部开始-->
<div class="tagDiv">
</div>
